Respect the delimiter of completer in Python shell completion
authorLiu Hui <liuhui1610@gmail.com>
Thu, 18 Jan 2024 04:00:00 +0000 (12:00 +0800)
committerEli Zaretskii <eliz@gnu.org>
Thu, 8 Feb 2024 12:09:42 +0000 (14:09 +0200)
commit0b9c7148fd681c8ad63fd0eb3895db44403e9f8c
treed454370049b289722ba06e2777e6006fcf762917
parentebf4ef2022a5f0a69cdd881eb41104e7b59d698e
Respect the delimiter of completer in Python shell completion

* lisp/progmodes/python.el: (python-shell-completion-setup-code): Fix
the completion code of IPython.  Change the return value to JSON string
and ...
(python-shell-completion-get-completions): ... simplify parsing.
(inferior-python-mode): Update docstring.
(python-shell-readline-completer-delims): New variable indicating the
word delimiters of readline completer.
(python-shell-completion-native-setup): Set the completer delimiter.
(python-shell-completion-native-get-completions): Convert output string
to completions properly.
(python-shell--get-multiline-input)
(python-shell--extra-completion-context)
(python-shell-completion-extra-context): New functions.
(python-shell-completion-at-point): Send text beginning from the line
start if the completion backend does not need word splitting.  Remove
the detection of import statement because it is not needed anymore.
Create proper completion table based on completions returned from
different backends.

* test/lisp/progmodes/python-tests.el (python-tests--completion-module)
(python-tests--completion-parameters)
(python-tests--completion-extra-context): New helper functions.
(python-shell-completion-at-point-jedi-completer)
(python-shell-completion-at-point-ipython): New tests.  (bug#68559)
lisp/progmodes/python.el
test/lisp/progmodes/python-tests.el